Skip to content

bpo-44572: On Windows platform disconnect STDIN in platform._syscmd_ver() to prevent erroneous STDIN consumption#27050

Closed
Konstantin-Glukhov wants to merge 3073 commits into
3.9from
main
Closed

bpo-44572: On Windows platform disconnect STDIN in platform._syscmd_ver() to prevent erroneous STDIN consumption#27050
Konstantin-Glukhov wants to merge 3073 commits into
3.9from
main

Conversation

@Konstantin-Glukhov

@Konstantin-Glukhov Konstantin-Glukhov commented Jul 7, 2021

Copy link
Copy Markdown

If script.py contains a call to platform.win32* functions the following invocation
inadvertently consumes STDIN redirected from file:

python.exe script.py < file

To address the issue, stdin=subprocess.DEVNULL argument needs to be added to subprocess.check_output() call in platform._syscmd_ver().

https://bugs.python.org/issue44572

felixxm and others added 30 commits June 2, 2021 13:30
…eck (GH-26486)

This was flagged by a static analyzer, but the logic of why this is NULL on error is hard to follow for humans as well.
Bumps [actions/cache](https://github.com/actions/cache) from 2.1.5 to 2.1.6.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](actions/cache@v2.1.5...v2.1.6)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Fix test_pha_required_nocert() of test_ssl: catch two more EOF cases
(when the recv() method returns an empty string).
…ots (GH-26491)

Signed-off-by: Tal Einat <532281+taleinat@users.noreply.github.com>
It wasn't actually detecting the regression due to the
assertion being too lenient.
BPO-42914 was not added to the What's New in #24864. This includes it in the "Improved Modules" section.

Automerge-Triggered-By: GH:gpshead
Added a function that returns a copy of a dict of logging levels.
Try to harden connection close:

- add tests that exercise stuff against a closed database
- add wrapper for sqlite3_close_v2()
- check connection on __enter__
- explicitly free pending statements before close()
- sqlite3_close_v2() always returns SQLITE_OK
Fix test_ssl.test_wrong_cert_tls13(): use suppress_ragged_eofs=False,
since read() can raise ssl.SSLEOFError on Windows.
…d co_fastlocalkinds. (gh-26388)

A number of places in the code base (notably ceval.c and frameobject.c) rely on mapping variable names to indices in the frame "locals plus" array (AKA fast locals), and thus opargs.  Currently the compiler indirectly encodes that information on the code object as the tuples co_varnames, co_cellvars, and co_freevars.  At runtime the dependent code must calculate the proper mapping from those, which isn't ideal and impacts performance-sensitive sections.  This is something we can easily address in the compiler instead.

This change addresses the situation by replacing internal use of co_varnames, etc. with a single combined tuple of names in locals-plus order, along with a minimal array mapping each to its kind (local vs. cell vs. free).  These two new PyCodeObject fields, co_fastlocalnames and co_fastllocalkinds, are not exposed to Python code for now, but co_varnames, etc. are still available with the same values as before (though computed lazily).

Aside from the (mild) performance impact, there are a number of other benefits:

* there's now a clear, direct relationship between locals-plus and variables
* code that relies on the locals-plus-to-name mapping is simpler
* marshaled code objects are smaller and serialize/de-serialize faster

Also note that we can take this approach further by expanding the possible values in co_fastlocalkinds to include specific argument types (e.g. positional-only, kwargs).  Doing so would allow further speed-ups in _PyEval_MakeFrameVector(), which is where args get unpacked into the locals-plus array.  It would also allow us to shrink marshaled code objects even further.

https://bugs.python.org/issue43693
The sqlite3 module now fully implements the GC protocol, so there's no
need for this workaround anymore.

- Add and use managed resource helper for connections using TESTFN
- Sort test imports
- Split open-tests into their own test case

Automerge-Triggered-By: GH:vstinner
Convert the Py_TYPE() and Py_SIZE() macros to static inline
functions. The Py_SET_TYPE() and Py_SET_SIZE() functions must now be
used to set an object type and size.
…le (GH-24203)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
When compiling an AST object with a direct / indirect reference
cycles, on the conversion phase because of exceeding amount of
calls, a segfault was raised. This patch adds recursion guards to
places for preventing user inputs to not to crash AST but instead
raise a RecursionError.
Don't catch OSError, and check the SSLError message.
This commit stores the _PyRuntime structure in a section of the same name. This allows a debugging or crash reporting tool to quickly locate this structure at runtime without requiring the symbol table.

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
Merges locals and cells into a single array.
Saves a pointer in the interpreter and means that we don't need the LOAD_CLOSURE opcode any more

https://bugs.python.org/issue43693
I'm taking a break.

Signed-off-by: Christian Heimes <christian@python.org>
test_disallow_instantiation and test_readonly_types try to test all the available
digests, however under FIPS mode, while the algorithms are available, trying to use
them will fail with a ValueError.
* Revert "bpo-43693: Compute deref offsets in compiler (gh-25152)"

This reverts commit b2bf2bc.

* Revert "bpo-43693: Add new internal code objects fields: co_fastlocalnames and co_fastlocalkinds. (gh-26388)"

This reverts commit 2c1e258.

These two commits are breaking the refleak buildbots.
@the-knights-who-say-ni

Copy link
Copy Markdown

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@Konstantin-Glukhov

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@terryjreedy

Copy link
Copy Markdown
Member

A pull request should merge a branch of main on your fork into main. Please read the devguide and sign the CLA before submitting another pull request.

@terryjreedy terryjreedy closed this Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.